﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq;
using IkeCode.WP7.Wakeup.AppModel.Model;

namespace IkeCode.WP7.Wakeup.Service.AppDataContext
{
    public class AlarmContext : DataContext
    {
        public AlarmContext(string connectionString)
            : base(connectionString)
        { }

        public Table<AlarmModel> Alarms
        {
            get
            {
                return this.GetTable<AlarmModel>();
            }
        }

        public void AddAlarm(AlarmModel alarm)
        {
            using (var db = new AlarmContext(AppConfig.ConnectionString))
            {
                db.Alarms.InsertOnSubmit(alarm);
                db.SubmitChanges();
            }
        }
    }
}
